package net.lab1024.sa.admin.module.business.exam.controller;

import net.lab1024.sa.admin.module.business.exam.domain.form.add.CoursecAddForm;
import net.lab1024.sa.admin.module.business.exam.domain.form.query.CoursecQueryForm;
import net.lab1024.sa.admin.module.business.exam.domain.form.update.CoursecUpdateForm;
import net.lab1024.sa.admin.module.business.exam.domain.vo.CoursecVO;
import net.lab1024.sa.admin.module.business.exam.service.CoursecService;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import cn.dev33.satoken.annotation.SaCheckPermission;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 生产订单与机器对应表 Controller
 *
 * @Author AKITA
 * @Date 2025-06-30 15:46:01
 * @Copyright AKITA
 */

@RestController
@Tag(name = "生产订单与机器对应表")
public class CoursecController {

    @Resource
    private CoursecService coursecService;

    @PostMapping("/coursec/queryPage")

    public ResponseDTO<PageResult<CoursecVO>> queryPage(@RequestBody @Valid CoursecQueryForm queryForm) {
        return ResponseDTO.ok(coursecService.queryPage(queryForm));
    }


    @PostMapping("/coursec/add")

    public ResponseDTO<String> add(@RequestBody @Valid CoursecAddForm addForm) {
        return coursecService.add(addForm);
    }


    @PostMapping("/coursec/update")

    public ResponseDTO<String> update(@RequestBody @Valid CoursecUpdateForm updateForm) {
        return coursecService.update(updateForm);
    }


    @PostMapping("/coursec/batchDelete")

    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return coursecService.batchDelete(idList);
    }


    @GetMapping("/coursec/delete/{docEntry}")

    public ResponseDTO<String> batchDelete(@PathVariable Long docEntry) {
        return coursecService.delete(docEntry);
    }
}
